Verbose levels¶
Many operations within remotemanager
have a concept of Verbose
.
At the base level, this can be True or False, but you may also specify higher levels with integer values.
verbose
can be specified at the topelevel Dataset, or for the individual calls.
It functions much like a run_arg
, in that there is a hierarchy to it.
Basically, the more specific the call, the higher priority it has.
For example, if we set verbose=False
at the Dataset
level, it will disable output for that Dataset.
However if we then call run(verbose=True)
, that verbose option local to the run call will take priority over the global setting.
Default Level¶
By default, verbose is set to True
or 1
. This prints the basic runtime information you have already seen in other tutprials.
Here, we shall give a brief overview of what the different levels look like.
Note
In short, higher verbose number = more output in the terminal.
Muting Output¶
The most useful feature of verbose is being able to disable the output.
In some situations a lot of information can be printed all at once and it can be beneficial to disable the output for that operation.
[1]:
from remotemanager import Dataset
def f(inp):
return f'inp was {inp}'
ds = Dataset(f, verbose=False, skip=False)
[2]:
ds.append_run(args={'inp': 'first input'})
ds.append_run(args={'inp': 'second input'})
[3]:
ds.run()
[3]:
True
[4]:
ds.run()
[4]:
False
[5]:
ds.fetch_results()
[6]:
ds.results
[6]:
['inp was first input', 'inp was second input']
Increasing Verbosity¶
Verbose levels go the other way, you can increase the output by specifying a higher integer level.
Note
For debugging, the logging functionalities will be more beneficial.
[7]:
ds = Dataset(f, verbose=3, skip=False)
Dataset initialised
new url created with url details:
host: localhost
port: None
user: None
Creating a fresh Dataset w/ database at dataset-0ae54639.yaml
[8]:
ds.append_run(args={'inp': 'first input'})
ds.append_run(args={'inp': 'second input'})
appended run runner-0
appended run runner-1
[9]:
ds.run()
Staging Dataset...
assessing run for runner dataset-0ae54639-runner-0... running
assessing run for runner dataset-0ae54639-runner-1... running
Staged 2/2 Runners
Transferring for 2/2 Runners
Transferring 7 Files... Done
Remotely executing 2/2 Runners
[9]:
True
[10]:
ds.run()
Staging Dataset...
assessing run for runner dataset-0ae54639-runner-0... skipping already submitted run
assessing run for runner dataset-0ae54639-runner-1... skipping already submitted run
No Runners staged
No Transfer required
[10]:
False
[11]:
ds.fetch_results()
Fetching results
Checking Runner states
dataset-0ae54639-runner-0... Completed, pulling result, pulling error, pulling extras
dataset-0ae54639-runner-1... Completed, pulling result, pulling error, pulling extras
Transferring 4 Files... Done
[12]:
ds.fetch_results()
Fetching results
Checking Runner states
dataset-0ae54639-runner-0... Already marked Satisfied, no work needed
dataset-0ae54639-runner-1... Already marked Satisfied, no work needed
No Transfer Required
[13]:
ds.results
[13]:
['inp was first input', 'inp was second input']
Setting for individual objects¶
As was hinted at earlier, we can also set specific levels for different objects.
Dataset, URL and Runners all store their own verbose levels.
Dataset and URL can be set on creation.
URL will inherit from Dataset if not set.
Runner is set at append_run
.
[14]:
from remotemanager import URL
no_verbose_url = URL(verbose=2)
ds = Dataset(f, verbose=1, url = no_verbose_url, skip=False)
new url created with url details:
host: localhost
port: None
user: None
[15]:
ds.append_run(args={'inp': 'first input'}, verbose = 0)
ds.append_run(args={'inp': 'second input'}, verbose = 0)
appended run runner-0
appended run runner-1
Quiet Mode¶
Since Runners inherit their verbose level from the append_run
call, there is a special quiet
argument here.
This is for the case where you want to silently append runners, but not have the runners themselves be silent.
[16]:
ds = Dataset(f, skip=False)
[17]:
ds.append_run(args={'inp': 'first input'}, quiet=True)
ds.append_run(args={'inp': 'second input'}, quiet=True)
[18]:
ds.run()
Staging Dataset... Staged 2/2 Runners
Transferring for 2/2 Runners
Transferring 7 Files... Done
Remotely executing 2/2 Runners
[18]:
True
[19]:
ds.fetch_results()
Fetching results
Transferring 4 Files... Done
[20]:
ds.fetch_results()
Fetching results
No Transfer Required
[21]:
ds.results
[21]:
['inp was first input', 'inp was second input']
Distinction between Logger.level, verbose and quiet¶
Logger.level
, verbose
and quiet
are all separate entities. For example, if you have Logger.level
set to debug
, and verbose=0
. The logfile will still contain messages at debug
level, but nothing will be printed to the terminal.
Quiet
simply mutes any printing (not logging) for the duration of that call.